﻿using UnityEngine;
using System.Collections;

public enum EBombState
{
    IDLE,
    EXPLORE,
}

public enum EBombType
{
    BLACK,
    BLUE,
    GREEN,
    YELLOW,
    RED,
    PINK
}

public class BombController : MonoBehaviour {



    private float timeFrame;
    private int indexStart;
    private int indexEnd;
    private float timeExplore;

    public EBombType bombType;
    [HideInInspector]
    public BombAnimation bombAnimation;

    #region STATE MACHINE
    FiniteStateMachine<BombController> FSM;

    EBombState stateAction;
    public EBombState StateAction
    {
        get
        {
            return stateAction;
        }
        set
        {
            if (stateAction != value)
            {
                stateAction = value;
                switch (stateAction)
                {
                    case EBombState.IDLE:
                        //changeState(.Instance);
                        break;
                    case EBombState.EXPLORE:
                       // changeState(DragonStateMove.Instance);
                        break;
                    
                }
            }
        }
    }

    #endregion

    void Awake()
    {
        FSM = new FiniteStateMachine<BombController>();
        FSM.Configure(this, BombIdleState.Instance);

        bombAnimation = this.transform.GetComponentInChildren<BombAnimation>();
        stateAction = EBombState.IDLE;
    }

    void Start()
    {
        runResources();
    }

    void runResources()
    {
        bombAnimation.ChangeResources(stateAction, bombType);
    }
    

    void changeState(FSMState<BombController> e )
    {
        FSM.Change(e);
        runResources();
    }
    void Update()
    {
        FSM.Update();
    }
    
}
